<%@ page import="coop.bancocredicoop.proyectos.gd.controller.buscarDocumento.Main" %>
<%@ page import="coop.bancocredicoop.proyectos.gd.domain.Document" %>
<%@ page import="java.util.List" %>

<script>
	$('#buscar-btn').click(function () {
		$('#buscar-btn').button('loading')
		
		$('#resultadoBusquedaClientes').load("${pageContext.request.contextPath}/jsp/buscarCliente/buscar.jsp",
				"buscar=buscar" + "&tipoPersona=" + $('#tipoPersona').val() +
				"&buscarPor=" + $('#buscarPor').val() + "&valor=" +
				$('#valor').val(),
				function() {
					$('#buscar-btn').button('reset')
				})
	});

	/*
	prevent return key from submitting form
	*/
	$(document).ready(function() {
		  $(window).keydown(function(event){
		    if(event.keyCode == 13) {
		      event.preventDefault();
		      cargarResultadoBusqueda()
		      return false;
		    }
		  });
		});
</script>

<div class="modal-dialog">
	<div class="modal-content">

		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		</div>

		<div class="modal-body">
			<g:form role="form" method="POST">
				<div class="form-group">
					<label for="tipoPersona">Tipo Persona</label>
					<select class="form-control" name="tipoPersona" id="tipoPersona">
						<option value="A">Ambas</option>
						<option value="J">Jur&iacute;dica</option>
						<option value="F">F&iacute;sica</option>
					</select>
				</div>
				<div class="form-group">
					<label for="buscarPor">Buscar por</label>
					<select class="form-control" name="buscarPor" id="buscarPor">
						<option value="idPersona">ID</option>
						<option value="cuit">Nro. de CUIT/CUIL</option>
						<option value="nombre">Denominaci&oacute;n</option>
					</select>
				</div>
				<div class="form-group">
					<label for="valor">Valor</label>
					<input type="text" class="form-control" name="valor" id="valor" placeholder="Valor">
				</div>
				<div class="form-group">
					<button type="button" id="buscar-btn" class="btn btn-primary" data-loading-text="Cargando..." >Buscar</button>
				</div>
				<div id="resultadoBusquedaClientes">
				</div>
			</g:form>
		</div>

		<div class="modal-footer">
		</div>

	</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
